//
//  YWTimeTool.m
//  YWPhotoEditMaster
//
//  Created by jun peng on 2023/9/15.
//

#import "YWTimeTool.h"

@implementation YWTimeTool


+(NSString *)getFormatTime:(NSInteger)timeInterval{
    
    // timeInterval 21.123
    NSInteger min = timeInterval / 60;
    NSInteger sec = timeInterval % 60;
    
    return [NSString stringWithFormat:@"%02ld:%02ld",min,sec];
    
    
    
}

+(NSInteger)getTimeInterval:(NSString *)formatTime{
    
    // 00:00.91
    NSArray *minSec = [formatTime componentsSeparatedByString:@":"];
    
    
    if (minSec.count != 2) {
        return 0;
    }
    NSString *minStr = minSec[0];
    NSString *secStr = minSec[1];
    
    NSInteger min = minStr.integerValue;
    NSInteger sec = secStr.integerValue;
    
    return min * 60.0 + sec;
    
}


@end
